import request from '../../views/components/utils/request.js'

// 查询单位信息列表
export function listUnit(query) {
  return request({
    url: '/unit/unit/list',
    method: 'get',
    params: query
  })
}

// 查询可被抽取单位信息列表
export function randomlist(query) {
  return request({
    url: '/unit/unit/listlose',
    method: 'get',
    params: query
  })
}

//查询所有单位信息列表
export function randomAllList(query){
  return request({
      url: '/unit/unit/list',
      method: 'get',
      params: query
  });
}

// 所勾选的单位信息
export function selectRandomAllList(query) {
  return request({
    url: '/unit/unit/listlose?unitIds='+query.ids+'&unitType='+query.randomUnittypeId,
    method: 'get',
  })
}
export function agentlist(query) {
  return request({
    url: '/unit/unit/agentlistlose',
    method: 'get',
    params: query
  })
}
export function agentlistlose(query) {
  return request({
    url: '/unit/unit/agentlistlose?unitIds='+query.ids+'&unitType='+query.randomUnittypeId,
    method: 'get',
  })
}


// 查询单位信息详细
export function getUnit(unitId) {
  return request({
    url: '/unit/unit/' + unitId,
    method: 'get'
  })
}
// 查询正在进行中的项目
export function getGoingUnit(params) {
  return request({
    url: '/unit/extract/UnitDoExtracts',
    method: 'get',
    params
  })
}

// 新增单位信息
export function addUnit(data) {
  return request({
    url: '/unit/unit',
    method: 'post',
    data: data
  })
}

// 修改单位信息
export function updateUnit(data) {
  return request({
    url: '/unit/unit',
    method: 'put',
    data: data
  })
}

// 删除单位信息
export function delUnit(unitId) {
  return request({
    url: '/unit/unit/' + unitId,
    method: 'delete'
  })
}

// 导出单位信息
export function exportUnit(query) {
  return request({
    url: '/unit/unit/export',
    method: 'get',
    params: query
  })
}

// 修改单位启用与禁用
export function modifyDisable(data) {
  return request({
    url: '/unit/unit/forbidden',
    method: 'post',
    data: data
  })
}

//查询出被禁用的单位信息
export function forbiddenList(query) {
  return request({
    url: '/unit/unit/forbiddenList',
    method: 'get',
    params: query
  })
}

export function getUnitInfoList(query) {
  return request.get('/unit/unit/getUnitInformation', {params: query});
}

export function getSomeUnitList(data) {
  return request.post("/unit/unit/getSomeUnitList", data);
}

export function extractControl(data) {
  return request.post("/unit/unit/changeUnitNum", data);
}

export function getLog(id) {
  return request.get("/unit/extract/selectLogById", {params: {id}});
}

export function getExtractUnit(params) {
  return request.get("/system/unit/getExtractUnit", {params});
}

//批量设置倍率
export function multiSet(data) {
  return request.post("/unit/unit/setRatio", data);
}

export function getRandomList(params) {
  return request.get("/unit/random/randomList", {params});
}

//发送短信
export function sendSmg(data) {
  return request.post("/sms/sendMsg", data);
}
//回执列表
export function getReceipt(params) {
  return request.get("/sms/index", {params});
}